#' Online MA oscillator
#'
#' @param fast_period fast rolling window period
#' @param slow_period slow rolling window period
#' @param type type of the moving average
#'
#' @return an maosc object
#' @export
#'
new_maosc <- function(fast_period, slow_period, type = c("sma", "tma", "wma", "hma",
                                                         "ema", "dema", "tema", "t3ma", "ewma",
                                                         "zlema", "vwma", "evwma"))
{
  type <- match.arg(type)
  switch(type,
         sma   = mk_online_func_x("smosc", fast_period, slow_period),
         tma   = mk_online_func_x("tmosc", fast_period, slow_period),
         wma   = mk_online_func_x("wmosc", fast_period, slow_period),
         hma   = mk_online_func_x("hmosc", fast_period, slow_period),
         ema   = mk_online_func_x("emosc", fast_period, slow_period),
         dema  = mk_online_func_x("demosc", fast_period, slow_period),
         tema  = mk_online_func_x("temosc", fast_period, slow_period),
         t3ma  = mk_online_func_x("t3mosc", fast_period, slow_period),
         ewma  = mk_online_func_x("ewmosc", fast_period, slow_period),
         zlema = mk_online_func_x("zlemosc", fast_period, slow_period),
         vwma  = mk_online_func_xw("vwmosc", fast_period, slow_period),
         evwma = mk_online_func_xw("evwmosc", fast_period, slow_period))
}
